package
{
	import mx.utils.StringUtil;
	
	import spark.components.TextInput;
	
	public class CustomTextInput extends TextInput
	{	
		//Praem
		//user can set two type of format
		//0xFFFFFF
		//#161616		
		private var _borderColor:String = "";	
		
		//interface of background color to skin
		private var _borderColorInterface:uint = 0x000000; 
		
		[Bindable]
		public var borderThickness:Number = 1;
		[Bindable]
		public var borderAlpha:Number;
	
		//Praem
		//user can set two type of format
		//0xFFFFFF
		//#161616
		private var _backgroundColor:String = "";
				
		//interface of background color to skin
		private var _backgroundColorInterface:uint = 0xFFFFFF;
		
		//padding property for align text
		private var _paddingTop:Number = 0;
		private var _paddingBottom:Number = 0;
		private var _paddingLeft:Number = 0;
		private var _paddingRight:Number = 0;
		
		[Bindable]
		public var backgroundAlpha:Number;
		
		public function CustomTextInput()
		{
			super();
		}

		[Bindable]
		public function get borderColor():String
		{
			return _borderColor;
		}

		public function set borderColor(value:String):void
		{
			_borderColorInterface = convertColorCode(value);
		}

		[Bindable]
		public function get backgroundColor():String
		{
			return _backgroundColor;
		}

		public function set backgroundColor(value:String):void
		{
			_backgroundColorInterface = convertColorCode(value)
		}

		public function get backgroundColorInterface():uint
		{
			return _backgroundColorInterface;
		}
		
		public function get borderColorInterface():uint
		{
			return _borderColorInterface;
		}
		
		public static function convertColorCode(value:String):uint
		{
			value = StringUtil.trim(value);
			//if (cc.indexOf("#")!= -1 && cc.charAt(0) == "#")
			if (value.indexOf("#")!= -1)
			{
				return uint("0x" + value.substr(1))
			}
			else
			{
				return uint(value);
			}
		}

		[Bindable]
		public function get paddingTop():Number
		{
			return _paddingTop;
		}

		public function set paddingTop(value:Number):void
		{
			_paddingTop = value;
		}

		[Bindable]
		public function get paddingBottom():Number
		{
			return _paddingBottom;
		}

		public function set paddingBottom(value:Number):void
		{
			_paddingBottom = value;
		}

		[Bindable]
		public function get paddingLeft():Number
		{
			return _paddingLeft;
		}

		public function set paddingLeft(value:Number):void
		{
			_paddingLeft = value;
		}

		[Bindable]
		public function get paddingRight():Number
		{
			return _paddingRight;
		}

		public function set paddingRight(value:Number):void
		{
			_paddingRight = value;
		}


	}
}